package com.nc.addre_demo;

//import org.junit.jupiter.api.Test;

import org.junit.Test;

public class ADTest {

    public static void main(String[] args) {

    }

    /**
     * Integer和String类的地址问题
     * Integer valueOf(int i)
     *  * This method will always cache values in the range -128 to 127,
     */
    @Test
    public void test1() {
        Integer i1 = 128;//相当于 Integer i1=Integer valueOf(128)
        Integer i2 = 128;
        Integer i3 = 100;
        Integer i4 = 100;
        String s1 = "100";
        String s3 = "100";
        String s2 = "1" + new String("00");
//        System.out.println(i1 == i2);//false
//        System.out.println(i3 == i4);//true
        System.out.println(s1 == s2);//false
        System.out.println(s1 == s3);//true
    }

}
